﻿using System;
using System.Windows.Forms;

namespace idataplatform
{
    public partial class cksel : Form
    {
        public cksel()
        {
            InitializeComponent();
        }

        private void cksel_Load(object sender, EventArgs e)
        {
            dateTimePicker1.Value = DateTime.Now.Date.AddDays(-7);
            dateTimePicker2.Value = DateTime.Now.Date.AddDays(-1);
            pubcls.ckselSQL = "";
        }

        private void button2_Click(object sender, EventArgs e)
        {
            dateTimePicker1.Value = DateTime.Now.Date.AddDays(-7);
            dateTimePicker2.Value = DateTime.Now.Date.AddDays(-1);
            comboBox1.Text = "";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.Text == "")
            {
                pubcls.ckselSQL = "SELECT ckdate,ckweek,klno,clno,nmno,mwno FROM ckdata_ipark WHERE ckdate>='" + dateTimePicker1.Value.ToShortDateString() + "' AND ckdate<='" + dateTimePicker2.Value.ToShortDateString() + "' ORDER BY ckdate DESC;";
            }
            else
            {
                pubcls.ckselSQL = "SELECT ckdate,ckweek,klno,clno,nmno,mwno FROM ckdata_ipark WHERE ckdate>='" + dateTimePicker1.Value.ToShortDateString() + "' AND ckdate<='" + dateTimePicker2.Value.ToShortDateString() + "' AND ckweek='" + comboBox1.Text + "' ORDER BY ckdate DESC;";
            }

            this.DialogResult = DialogResult.OK;
            this.Dispose();
            this.Close();
        }
    }
}
